package org.p2psimulator.analysis.jfreechart;

import java.awt.Color;
import java.awt.HeadlessException;

import org.jfree.chart.ChartFactory;
import org.jfree.chart.JFreeChart;
import org.jfree.data.general.Dataset;
import org.jfree.data.general.PieDataset;

@SuppressWarnings("serial")
public class PieChartBoard extends ChartBoard {

	public PieChartBoard(String title, PieDataset dataset) throws HeadlessException {

		super(title, dataset, null, null);
	}
	@Override
	public JFreeChart createChart(Dataset dataset, String xlabel,
			String ylabel) {

		PieDataset pieDataset = (PieDataset) dataset;
		JFreeChart chart = ChartFactory.createPieChart(
	            super.getTitle(),  // chart title
	            pieDataset,             // dataset
	            true,               // include legend
	            true,
	            false
	        );



		// NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
		// set the background color for the chart...
		chart.setBackgroundPaint(Color.white);

		return chart;
	}

}
